import React from 'react';
import Menu from '@/components/common/menu'
const BusinessIndex = () => {
    let navigate = React.Router.useNavigate();
    const Logout = () => 
    {
        React.UI.Dialog.confirm({
            title: '退出',
            content: '确认是否退出登陆?',
            onConfirm: () => 
            {
                React.Cookie.remove('Business');
                navigate('/business/login')
            }
        }).catch(() => {})
    }

    const AuthEmail = () =>
    {
        if(React.Business.auth == '1')
        {
            React.success('邮箱已认证，无需重复认证');
            return false
        }

        navigate('/business/email')
    }

    return (
        <>
            <link rel="stylesheet" href="/assets/css/user.css" />
            <div className="header">
                <div className="userinfo">
                    <div className="avatar">
                        <img src={React.Business.avatar_text} alt="" />
                    </div>
                    <div className="nickname">{React.Business.nickname}</div>
                    <div className="nickname content"></div>
                </div>
                <div className="corrugated">
                    <div className="wave-top wave-item"></div>
                    <div className="wave-middle wave-item"></div>
                    <div className="wave-bottom wave-item"></div>
                </div>
            </div>
            <div className="menu-cell">
                <div className="item">
                    <React.Router.NavLink to="/business/profile">
                        <div className="title">个人资料</div>
                        <div className="icon">
                            <img src="/assets/images/right.png" alt="" />
                        </div>
                    </React.Router.NavLink>
                </div>
                <div className="item">
                    <a onClick={AuthEmail}>
                        <div className="title">邮箱认证</div>
                        <div className="icon">
                            <img src="/assets/images/right.png" alt="" />
                        </div>
                    </a>
                </div>
                <div className="item">
                    <React.Router.NavLink to="/guest/index">
                        <div className="title">住客信息</div>
                        <div className="icon">
                            <img src="/assets/images/right.png" alt="" />
                        </div>
                    </React.Router.NavLink>
                </div>
                <div className="item">
                    <a href="order.html">
                        <div className="title">房间订单</div>
                        <div className="icon">
                            <img src="/assets/images/right.png" alt="" />
                        </div>
                    </a>
                </div>
                <div className="item">
                    <React.Router.NavLink to="/business/coupon">
                        <div className="title">我的优惠券</div>
                        <div className="icon">
                            <img src="/assets/images/right.png" alt="" />
                        </div>
                    </React.Router.NavLink>
                </div>
                <div className="item">
                    <a href="hotel-info.html">
                        <div className="title">关于我们</div>
                        <div className="icon">
                            <img src="/assets/images/right.png" alt="" />
                        </div>
                    </a>
                </div>
                <div className="item">
                    <a onClick={Logout}>
                        <div className="title">退出登陆</div>
                        <div className="icon">
                            <img src="/assets/images/right.png" alt="" />
                        </div>
                    </a>
                </div>
            </div>
            <Menu />
        </>
    )
}

export default BusinessIndex;